package MountainMq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注册死信交换机队列，并绑定
 */
@Configuration
public class DlxConfig {
    @Bean
    public TopicExchange dlxExchange(){
        return new TopicExchange("exchange.dlx");
    }

    @Bean
    public Queue dlxQueue(){
        return new Queue("queue.dlx",true,false,false);
    }

    @Bean
    public Binding dlxBinding(){
        return BindingBuilder.bind(dlxQueue()).to(dlxExchange()).with("#");
    }
}
